package graphics;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;

import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import core.CustomerManagement;
import core.UtilityFunctions;
import db.DBConnection;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VisualizzaClienteJPanel extends javax.swing.JPanel {
	private JLabel codiceFiscalejLabel;
	private JTextField provinciajTextField;
	private JLabel provinciajLabel;
	private JLabel iconjLabel;
	private JButton salvajButton;
	private JLabel numerojLabel;
	private JTextField numeroDiTelefonojTextField;
	private JLabel comunejLabel;
	private JTextField codiceFiscalejTextField;
	private JTextField comunejTextField;
	private JLabel indirizzojLabel;
	private JTextField indirizzojTextField;
	private JLabel ragioneSocialejLabel;
	private JTextField ragioneSocialejTextField;
	private JLabel cognomejLabel;
	private JTextField cognomejTextField;
	private JLabel nomejLabel;
	private JTextField nomejTextField;
	private JTextField partitaIVAjTextField;
	private JLabel partitaIvajLabel;
	
	private int codiceCliente;
	private ResultSet res;

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}


	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new VisualizzaClienteJPanel(2));
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
	public VisualizzaClienteJPanel(int codiceCliente) {
		super();
		this.codiceCliente = codiceCliente;
		initializeFromDB();
		initGUI();
		this.aggiungiKeyListener();
		
	}
	
	private void initializeFromDB()
	{
		UtilityFunctions ut = new UtilityFunctions();
		String query = "SELECT * FROM CLIENTE WHERE CODICECLIENTE = ?";
		try {
			res  = ut.executeParametricQuerySingleParameter(new DBConnection(), query, ""+codiceCliente);
			res.next();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)this);
			this.setLayout(thisLayout);
			this.setPreferredSize(new java.awt.Dimension(587, 436));
			{
				codiceFiscalejLabel = new JLabel();
				codiceFiscalejLabel.setText("Codice Fiscale");
			}
			{
				codiceFiscalejTextField = new JTextField();
				codiceFiscalejTextField.setText(res.getString("CODICEFISCALE"));
				codiceFiscalejTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent arg0) {
						// TODO Auto-generated method stub
					}
					
					@Override
					public void keyReleased(KeyEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent arg0) {
						// TODO Auto-generated method stub
						int tasto = arg0.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							codiceFiscalejTextField.transferFocus();
						}
					}
				});
			}
			{
				salvajButton = new JButton();
				salvajButton.setText("Salva (F12)");
				salvajButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/save-icon32.png")));
				// salvajButton.setMnemonic(KeyEvent.VK_F12);
				salvajButton.addActionListener(new ActionListener() {
					@Override
					public void actionPerformed(ActionEvent arg0) {
						// TODO Auto-generated method stub
						salvaCliente();
					}
				});
				
			}
			{
				iconjLabel = new JLabel();
				iconjLabel.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/add_user.png")));
			}
			{
				partitaIvajLabel = new JLabel();
				partitaIvajLabel.setText("Partita IVA");
			}
			{
				partitaIVAjTextField = new JTextField();
				partitaIVAjTextField.setText(res.getString("PARTITAIVA"));
				partitaIVAjTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyReleased(KeyEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent arg0) {
						// TODO Auto-generated method stub
						int tasto = arg0.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							partitaIVAjTextField.transferFocus();
						}
					}
				});
			}
			{
				nomejTextField = new JTextField();
				nomejTextField.setText(res.getString("NOME"));
				nomejTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyReleased(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent e) {
						// TODO Auto-generated method stub
						int tasto = e.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							nomejTextField.transferFocus();
						}
					}
				});
			}
			{
				nomejLabel = new JLabel();
				nomejLabel.setText("Nome");
			}
			{
				cognomejTextField = new JTextField();
				cognomejTextField.setText(res.getString("COGNOME"));
				cognomejTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyReleased(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent e) {
						// TODO Auto-generated method stub
						int tasto = e.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							cognomejTextField.transferFocus();
						}
					}
				});
			}
			{
				cognomejLabel = new JLabel();
				cognomejLabel.setText("Cognome");
			}
			{
				ragioneSocialejTextField = new JTextField();
				ragioneSocialejTextField.setText(res.getString("RAGIONESOCIALE"));
				ragioneSocialejTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyReleased(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent e) {
						// TODO Auto-generated method stub
						int tasto = e.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							ragioneSocialejTextField.transferFocus();
						}
					}
				});
			}
			{
				ragioneSocialejLabel = new JLabel();
				ragioneSocialejLabel.setText("Ragione Sociale");
			}
			{
				indirizzojTextField = new JTextField();
				indirizzojTextField.setText(res.getString("INDIRIZZO"));
				indirizzojTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyReleased(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent e) {
						// TODO Auto-generated method stub
						int tasto = e.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							indirizzojTextField.transferFocus();
						}
					}
				});
			}
			{
				indirizzojLabel = new JLabel();
				indirizzojLabel.setText("Indirizzo");
			}
			{
				comunejTextField = new JTextField();
				comunejTextField.setText(res.getString("COMUNE"));
				comunejTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyReleased(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent e) {
						// TODO Auto-generated method stub
						int tasto = e.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							comunejTextField.transferFocus();
						}
					}
				});
			}
			{
				comunejLabel = new JLabel();
				comunejLabel.setText("Comune");
			}
			{
				provinciajTextField = new JTextField();
				provinciajTextField.setText(res.getString("PROVINCIA"));
				provinciajTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyReleased(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent e) {
						// TODO Auto-generated method stub
						int tasto = e.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							provinciajTextField.transferFocus();
						}
					}
				});
			}
			{
				provinciajLabel = new JLabel();
				provinciajLabel.setText("Provincia");
			}
			{
				numeroDiTelefonojTextField = new JTextField();
				numeroDiTelefonojTextField.setText(res.getString("NUMEROTELEFONO"));
				numeroDiTelefonojTextField.addKeyListener(new KeyListener() {
					
					@Override
					public void keyTyped(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyReleased(KeyEvent e) {
						// TODO Auto-generated method stub
						
					}
					
					@Override
					public void keyPressed(KeyEvent e) {
						// TODO Auto-generated method stub
						int tasto = e.getKeyCode();
						if(tasto == KeyEvent.VK_F12)
						{
							salvaCliente();
						}
						else if(tasto == KeyEvent.VK_ENTER)
						{
							numeroDiTelefonojTextField.transferFocus();
						}
					}
				});
			}
			{
				numerojLabel = new JLabel();
				numerojLabel.setText("Numero tel");
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(55, 55)
				.addGroup(thisLayout.createParallelGroup()
				    .addGroup(thisLayout.createSequentialGroup()
				        .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				            .addComponent(codiceFiscalejTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				            .addComponent(codiceFiscalejLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE)
				        .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				            .addComponent(partitaIVAjTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)
				            .addComponent(partitaIvajLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				        .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				            .addComponent(nomejTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				            .addComponent(nomejLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				        .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				            .addComponent(cognomejTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
				            .addComponent(cognomejLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				        .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				            .addComponent(ragioneSocialejTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				            .addComponent(ragioneSocialejLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				        .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				            .addComponent(indirizzojTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				            .addComponent(indirizzojLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				        .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				            .addComponent(comunejTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				            .addComponent(comunejLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE)
				        .addComponent(iconjLabel, GroupLayout.PREFERRED_SIZE, 217, GroupLayout.PREFERRED_SIZE)
				        .addGap(9)))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(provinciajTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(provinciajLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(numeroDiTelefonojTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(numerojLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addGap(19)
				.addComponent(salvajButton, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(20, 20));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(33, 33)
				.addGroup(thisLayout.createParallelGroup()
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(numerojLabel, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
				        .addGap(35))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(provinciajLabel, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
				        .addGap(35))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(comunejLabel, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
				        .addGap(35))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(indirizzojLabel, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
				        .addGap(35))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(ragioneSocialejLabel, GroupLayout.PREFERRED_SIZE, 118, GroupLayout.PREFERRED_SIZE)
				        .addGap(12))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(cognomejLabel, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
				        .addGap(35))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(nomejLabel, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
				        .addGap(89))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(partitaIvajLabel, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
				        .addGap(35))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(codiceFiscalejLabel, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
				        .addGap(35))
				    .addComponent(salvajButton, GroupLayout.Alignment.LEADING, 0, 130, Short.MAX_VALUE))
				.addGroup(thisLayout.createParallelGroup()
				    .addComponent(numeroDiTelefonojTextField, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(provinciajTextField, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
				        .addGap(93))
				    .addComponent(comunejTextField, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
				    .addComponent(indirizzojTextField, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
				    .addComponent(ragioneSocialejTextField, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
				    .addComponent(cognomejTextField, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
				    .addComponent(nomejTextField, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
				    .addComponent(partitaIVAjTextField, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
				    .addComponent(codiceFiscalejTextField, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE))
				.addGap(0, 66, GroupLayout.PREFERRED_SIZE)
				.addComponent(iconjLabel, GroupLayout.PREFERRED_SIZE, 142, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(78, 78));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private void aggiungiKeyListener()
	{
		this.requestFocusInWindow();
		this.addKeyListener(new KeyListener() {
			
			@Override
			public void keyTyped(KeyEvent arg0) {
				// TODO Auto-generated method stub
				int tasto = arg0.getKeyCode();
				if(arg0.getKeyCode() == KeyEvent.VK_F12)
				{
					salvaCliente();
				}
			}
			
			@Override
			public void keyReleased(KeyEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void keyPressed(KeyEvent arg0) {
				// TODO Auto-generated method stub
				
			}
		});
	}
	
	private void salvaCliente()
	{
		System.out.println("salvo");
		if(((nomejTextField.getText().isEmpty() || cognomejTextField.getText().isEmpty()) && ragioneSocialejTextField.getText().isEmpty())
			|| indirizzojTextField.getText().isEmpty())
		{
			//Errore
		}
		else
		{
			String [] parameters = new String[] {"", "", "", "", "", "", "", "", ""};
			parameters[0] = codiceFiscalejTextField.getText();
			parameters[1] = partitaIVAjTextField.getText();
			parameters[2] = nomejTextField.getText();
			parameters[3] = cognomejTextField.getText();
			parameters[4] = ragioneSocialejTextField.getText();
			parameters[5] = indirizzojTextField.getText();
			parameters[6] = comunejTextField.getText();
			parameters[7] = provinciajTextField.getText();
			parameters[8] = numeroDiTelefonojTextField.getText();
			try {
				CustomerManagement.insertCustomer(new DBConnection(), parameters);
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
